﻿namespace Arms.Domain.Modules.Products
{
    using System;

    public class ProductFactory
    {
        /// <summary>
        /// Create a new product with ID, name and price.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <param name="price"></param>
        /// <returns></returns>
        public static T CreateProduct<T>(string name, double price) where T : ProductBase, new()
        {
            return ProductFactory.CreateProduct<T>(name, string.Empty, price);
        }
        /// <summary>
        /// Create a new product with ID, name, description and price.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="price"></param>
        /// <returns></returns>
        public static T CreateProduct<T>(string name, string description, double price) where T : ProductBase, new()
        {
            return ProductFactory.CreateProduct<T>(name, description, string.Empty, price);
        }
        /// <summary>
        /// Create a new product with ID, name, description, comment and price.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="comment"></param>
        /// <param name="price"></param>
        /// <returns></returns>
        public static T CreateProduct<T>(string name, string description, string comment, double price) where T : ProductBase, new()
        {
            var product = EntityFactory.CreateEntityDescribed<T>(name, description, comment);
            product.Price = price;
            return product;
        }
    }
}
